//通过classify获取文章详情
const db=require("../lib/db")
function classifyArticleList(classify){
    return new Promise((resolve,reject)=>{
        let sql="select * from article where classify="+classify;
      
        db.querysql(sql).then(data=>{
            if(data.length==0){
                resolve("没找到")
            }else{
                
                let arr=[]
                data.map(element=>{
                    arr.push({
                        _id: Buffer.from(String(element.id)).toString("Base64"),
                        title: element.title,
                        content: element.content,
                        desc: element.des,
                        time:element.time,
                        author: element.author,
                        authorId: element.authorId,
                    })
                })
                resolve(arr)
            }
        })
    })
}
module.exports=classifyArticleList